<template>
	<view class="container">
		<!-- 所有内容的容器 -->
		<!--头像-->
		<view class="u-m-t-20"  @click="userDetails()">
			<u-avatar :src="userInfo.imagepath" size="large"></u-avatar></u-avatar>
			<u-cell-item style="float: right;width: 80%;" :title="userInfo.username" class="u-flex"></u-cell-item>
		</view>
		<!-- 收藏与关注 -->
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="star" title="收藏" @click="collect()"></u-cell-item>
				<u-cell-item icon="heart" title="关注" @click="focus()"></u-cell-item>
			</u-cell-group>
		</view>
		<!-- 设置 -->
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="设置" @click="setting()"></u-cell-item>
			</u-cell-group>
		</view>
		<!-- 帮助说明 -->
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="question-circle" title="帮助说明" @click="help()"></u-cell-item>
			</u-cell-group>
		</view>
			<!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
			<u-tabbar active-color="#2b85e4" height="45px" bg-color="#f4f4f5" :list="tabbar"></u-tabbar>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				title: '个人中心',
				//当前用户信息
				userInfo:this.$store.state.user.userInfo,
				tabbar: '',
	
			}
		},
		watch:{
			"$store.state.user.userInfo"(){
				this.userInfo = this.$store.getters.user
			}
		},
		onLoad() {
			/**
			 * 示例中为每个tabbar页面都写了一遍tabbar变量，您可以将tabbar数组写入到vuex中，这样可以全局引用
			 */
			this.tabbar = this.$store.state.tabbar.tarbarList;
		},
		methods: {
			userDetails(){
				//跳转个人中心页面
				this.$u.route('pages/person-second-page/userDetails-page/userDetails-page');
			},
			collect(){
				//跳转收藏页面
				this.$u.route({
					url:'pages/person-second-page/collection-page/collection-page',
					params:{
						collectionId:this.$data.userInfo.userid
					}
				});
			},
			focus(){
				//跳转关注页面
				this.$u.route({
					url:'pages/person-second-page/focus-page/focus-page',
					params:{
						userId:this.$data.userInfo.userid
					}
				});
			},
			setting(){
				//跳转设置页面
				this.$u.route('pages/person-second-page/setting-page/setting-page');
			},
			help(){
				//跳转帮助说明页面
				this.$u.route('pages/person-second-page/help-page/help-page');
			}
		}
	}
</script>

<style>
	/* .u-tabbar{
		border-top: 10rpx solid #000000;
	} */
	.container{
		
	}
</style>
